// comments_view.js

import React from "react";
import { getFormatDate } from '../utils/date';
import './comments_view.css';

class CommentsView extends React.Component {
    render() {
        const { comments } = this.props;

        return (
            <ul className="commentsView">
                {comments.map(item => {
                    return (
                        <li key={item.comment_id}>
                            <div>{item.comment_info.content}</div>
                            <div className="sub">
                                <span>{item.comment_info.author.user_name}</span>
                                <span>·</span>
                                <span>{getFormatDate(item.comment_info.update_time)}</span>
                            </div>
                        </li>
                    );
                })}
            </ul>
        );
    }
}

export default CommentsView;
